package com.yuwei.movie.adapter

import android.graphics.Color
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.yuwei.movie.R
import com.yuwei.movie.entity.MovieTypeEntityItem
import kotlin.time.Duration.Companion.hours

class MovieTypeAdapter :
    BaseQuickAdapter<MovieTypeEntityItem, BaseViewHolder>(R.layout.movie_type_item) {
    private var position = 0
    fun setPosition(index: Int) {
        this.position = index
    }

    override fun convert(holder: BaseViewHolder, item: MovieTypeEntityItem) {
        if (position == holder.adapterPosition) {
            holder.setText(R.id.movie_type_text, item.typename)
                .setTextColor(R.id.movie_type_text, Color.parseColor("#FF2442"))
        } else {
            holder.setText(R.id.movie_type_text, item.typename)
                .setTextColor(R.id.movie_type_text, Color.parseColor("#4B5563"))
        }
    }
}